import 'dart:ui';

import 'package:cloud_phone_manager/contants/SelfColors.dart';
import 'package:flutter/cupertino.dart';

class LogItem{
  String content = "";
  String level = "";

  LogItem(this.content);

  Color getColor(){
    try{
      if(level.isEmpty){
        List<String> levelAarray = content.split(" ");
        List<String> tmp = [];
        for(String item in levelAarray){
          if(item.isNotEmpty){
            tmp.add(item);
          }
        }
        level = tmp[4].trim();
      }
      var color = SelfColors.Assert;
      if(level == "E"){
        color = SelfColors.Error;
      }else if(level == "W"){
        color =  SelfColors.Warn;
      }else if(level == "I"){
        color =  SelfColors.Info;
      }else{
        color =  SelfColors.Assert;
      }
      debugPrint("等级为："+level+",颜色为：${color}");
      return color;
    }catch(e){
      debugPrint("错误：${e}");
      return SelfColors.Assert;
    }
  }

}